﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace KDSugar.Galaxy.API.Base
{
    /// <summary>
    /// 携带了编号、内码和明细内码的操作指令抽象类
    /// </summary>
    public abstract class BaseNumberIdEntry : BaseNumbersIds
    {
        /// <summary>
        /// 携带了编号、内码和明细内码的操作指令抽象类|初始化
        /// </summary>
        /// <param name="_url"></param>
        /// <param name="_formId"></param>
        /// <param name="_client"></param>
        public BaseNumberIdEntry(string _url,string _formId,GalaxyCloudAPIClient _client)
            : base(_url, _formId, _client)
        {

        }

        /// <summary>
        /// 携带了编号、内码和明细内码的操作指令抽象类|初始化
        /// </summary>
        /// <param name="_url"></param>
        /// <param name="_formId"></param>
        /// <param name="_opNumber"></param>
        /// <param name="_client"></param>
        public BaseNumberIdEntry(string _url,string _formId,string _opNumber,GalaxyCloudAPIClient _client)
            : base(_url, _formId, _opNumber, _client)
        {

        }

        /// <summary>
        /// 分录内码集合
        /// </summary>
        public string EntryIds { get; private set; }

        /// <summary>
        /// 设置分录内码集合
        /// </summary>
        /// <param name="_entryIds">
        /// 分录内码集合
        /// <para>格式："Id1,Id2,..."</para>
        /// </param>
        public void SetEntryIds(string _entryIds)
        {
            EntryIds = _entryIds;
            FormIdTagType = Constant.FormIdTagTypeEnum.EntryId;
        }

        /// <summary>
        /// 设置分录内码集合
        /// </summary>
        /// <param name="_entryIds">分录内码集合</param>
        public void SetEntryIds(List<long> _entryIds)
        {
            EntryIds = Helper.ArraysToString(_entryIds);
            FormIdTagType = Constant.FormIdTagTypeEnum.EntryId;
        }

        /// <summary>
        /// 清理分录内码集合
        /// </summary>
        public override void CleanEntryId()
        {
            EntryIds = null;
        }
    }
}
